home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / recovcmd / recovcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-31  |  2.5 KB  |  95 lines

  1. /* 
  2.  * recovcmd.c --
  3.  *
  4.  *    User interface to recovery related commands.
  5.  *
  6.  * Copyright (C) 1986 Regents of the University of California
  7.  * All rights reserved.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The University of California
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  */
  16.  
  17. #ifndef lint
  18. static char rcsid[] = "$Header: /sprite/src/cmds/recovcmd/RCS/recovcmd.c,v 1.3 90/04/18 20:18:06 mgbaker Exp Locker: mgbaker $ SPRITE (Berkeley)";
  19. #endif not lint
  20.  
  21. #include "sprite.h"
  22. #include "status.h"
  23. #include "option.h"
  24. #include "stdio.h"
  25. #include "sysStats.h"
  26.  
  27. /*
  28.  * Command line options.
  29.  */
  30.  
  31. int    recovAbsolutePings = -1;
  32. int    recovStats = -1;
  33. int    printLevel = -1;
  34.  
  35. Option optionArray[] = {
  36.     {OPT_TRUE, "abson", (Address) &recovAbsolutePings, 
  37.     "\tMake recovery ping interval absolute."},
  38.     {OPT_FALSE, "absoff", (Address) &recovAbsolutePings, 
  39.     "\tMake recovery ping interval relative to when it finishes pinging."},
  40.     {OPT_TRUE, "recovStats", (Address) &recovStats, 
  41.     "\tPrint out recovery statistics."},
  42.     {OPT_INT, "printLevel", (Address) &printLevel, 
  43.     "\tSet recov trace print level (0=off, 1=default, 10=highest)."},
  44. };
  45. int numOptions = sizeof(optionArray) / sizeof(Option);
  46.  
  47.  
  48. /*
  49.  *----------------------------------------------------------------------
  50.  *
  51.  * main --
  52.  *
  53.  *    Collects arguments and branches to the code for the command.
  54.  *
  55.  * Results:
  56.  *    None.
  57.  *
  58.  * Side effects:
  59.  *    Calls the command.
  60.  *
  61.  *----------------------------------------------------------------------
  62.  */
  63. main(argc, argv)
  64.     int argc;
  65.     char *argv[];
  66. {
  67.     register ReturnStatus status = SUCCESS;    /* status of system calls */
  68.  
  69.     argc = Opt_Parse(argc, argv, optionArray, numOptions);
  70.  
  71.     /*
  72.      * Set various recov system flags.
  73.      */
  74.     if (recovAbsolutePings != -1) {
  75.     status = Sys_Stats(SYS_RECOV_ABS_PINGS, recovAbsolutePings, NIL);
  76.     }
  77.     if (printLevel != -1) {
  78.     status = Sys_Stats(SYS_RECOV_PRINT, printLevel, NIL);
  79.     }
  80. #ifdef NOTDEF
  81.     if (recovStats != -1) {
  82.     Recov_Stats    stats;
  83.  
  84.     status = Sys_Stats(SYS_RECOV_STATS, sizeof (Recov_Stats), &stats)
  85.     if (status != SUCCESS) {
  86.         fprintf(stderr, "Recov stats failed: error %x.\n", status)
  87.     } else {
  88.         fprintf(stderr,
  89.             "Haven't figured out what to do about this option yet.\n");
  90.     }
  91.     }
  92. #endif NOTDEF
  93.     exit(status);
  94. }
  95.